// PlayerButton.cpp : implementation file
//

#include "stdafx.h"
#include "MFCControl.h"
#include "PlayerButton.h"
#include "afx.h"

// PlayerButton

IMPLEMENT_DYNAMIC(PlayerButton, CBitmapButton)

PlayerButton::PlayerButton()
{
}

PlayerButton::~PlayerButton()
{
}

void PlayerButton::LoadButton(UINT Iup, UINT Idown, UINT Ifocus)
{
	up=Iup;
	down=Idown;
	focus=Ifocus;
	VERIFY(LoadBitmaps(up,down));
	VERIFY(RedrawWindow());
}

BEGIN_MESSAGE_MAP(PlayerButton, CBitmapButton)
	ON_WM_MOUSEMOVE()
	ON_WM_MOUSEHOVER()
	ON_WM_MOUSELEAVE()
END_MESSAGE_MAP()



// PlayerButton message handlers




void PlayerButton::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	TRACKMOUSEEVENT tme;
    tme.cbSize = sizeof(tme);
    tme.hwndTrack = m_hWnd;
    tme.dwFlags = TME_LEAVE|TME_HOVER;
    tme.dwHoverTime = 1;
    TrackMouseEvent(&tme);
	CBitmapButton::OnMouseMove(nFlags, point);
}


void PlayerButton::OnMouseHover(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	VERIFY(LoadBitmaps(focus,down));
	VERIFY(RedrawWindow());
	CBitmapButton::OnMouseHover(nFlags, point);
}


void PlayerButton::OnMouseLeave()
{
	// TODO: Add your message handler code here and/or call default
	VERIFY(LoadBitmaps(up,down));
	VERIFY(RedrawWindow());
	CBitmapButton::OnMouseLeave();
}
